from django.db import models
from rest_framework import serializers


# Create your models here.
class Category(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=50, unique=True, verbose_name='分类名称')
    image = models.CharField(max_length=500, verbose_name='封面图片')
    description = models.TextField(max_length=500, verbose_name='分类描述')

    class Meta:
        db_table = 'sys_category'


class CategorySerializer(serializers.ModelSerializer):
    class Meta:
        model = Category
        fields = '__all__'
